/*******************************************************************************
 * This file is part of blueprint4j www.blueprint4j.org.
 * 
 *     blueprint4j is free software: you can redistribute it and/or modify
 *     it under the terms of the GNU Lesser General Public License as published by
 *     the Free Software Foundation, either version 3 of the License, or
 *     (at your option) any later version.
 * 
 *     blueprint4j is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU Lesser General Public License for more details.
 * 
 *     You should have received a copy of the GNU Lesser General Public License
 *     along with blueprint4j. If not, see <http://www.gnu.org/licenses/>.
 ******************************************************************************/
package blueprint4j.report.db;

import blueprint4j.db.Entity;
import blueprint4j.utils.BindField;
import blueprint4j.utils.Bindable;
import blueprint4j.utils.BindableProperties;


public class FieldReport {

	private BindableProperties bindable = new BindableProperties();
	private BindField bind_field[] = null;
	private String report_name = null;
	private String description = null;
	private Entity entity = null;

	/**
	 *
	 */
	public FieldReport( String report_name, String p_description,BindField bind_field[],Entity entity ) {
		this.report_name = report_name;
		this.bind_field = bind_field;
		this.description = description;
		this.entity = entity;
		for (int i =0;i < bind_field.length;i++) {
			bindable.addField(bind_field[i]);
		}
	}

	/**
	 * Get the report resource name
	 */
	public String getReportName() {
		return report_name;
	}

	public BindField[] getBindField() {
		return bind_field;
	}

	public void addToBindable(Bindable bindable) {
		for (int i =0;i < bind_field.length;i++) {
			bindable.addField(bind_field[i]);
		}
	}

//	public DataGroup createDataGroup(Binder binder)
//	throws BindException {
//		try {
//			DataGroup edit = new DataGroup("Report Variables",Constants.ICON_BASE+"actions/frameprint.png");
//			for (int i =0;i < bind_field.length;i++) {
//				edit.add(binder.createDataPair(bind_field[i]));
//			}
//			return edit;
//		} catch (Exception exception) {
//			throw new BindException(exception);
//		}
//	}

//	public Report get()
//	throws BindException {
//		bindable.save();
//		Report rpt = new Report(
//		                entity.getConnection(),getReportName(),
//		                new VectorBindable(new Bindable[]{entity,bindable})
//		             );
//		rpt.build();
//		return rpt;
//	}

}
